import scrapy


class QsbkSpider(scrapy.Spider):
	name = 'qsbk'
	
	# allowed_domains = ['qiushibaike.com']
	# start_urls = ['https://www.qiushibaike.com/text/']
	
	# https://www.qiushibaike.com/text/page/2/ 翻页地址
	def start_requests(self):
		for i in range(1, 14):
			url = f'https://www.qiushibaike.com/text/page/{i}'
			yield scrapy.Request(url, callback=self.parse)
	
	def parse(self, response, **kwargs):
		texts = response.xpath('//div[@class="content"]/span/text()').extract()
		for text in texts:
			temp = str(text).strip()
			print(temp)
			yield {
				"text": temp
			}
